<?php
/**
 * GioCMS
 * 
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@ninhgio.com so we can send you a copy immediately.
 * 
 * @copyright	Copyright (c) 2010-2011 GioCMS (http://cms.ninhgio.com)
 * @license		http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @author		NinhGio - ninhgio@gmail.com
 * @since		1.0
 */
?>
<div class="ninhgio g_utility_dictionary" id="<?php echo $this->unid; ?>">
	<div class="boxShareClunmleft300">
	    <div class="boxShareClunmleft300Top">
	        <div class="boxShareClunmleft300Btom">
	            <div class="color3 bold fontsize15 padding6 textCter" style="border-bottom: 1px solid #DADADA;">
	                <?php echo $this->TRANSLATOR->widget('title'); ?>
				</div>
	            <div class="pd5">
	            	<textarea name="gUtilityDictionaryText" id="gUtilityDictionaryText"></textarea>
	            	<div class="clear"></div>
	            	<label><?php echo $this->TRANSLATOR->widget('from'); ?></label>
	            	<select name="gUtilityDictionaryFrom" id="gUtilityDictionaryFrom">
	            		<option value="en"><?php echo $this->TRANSLATOR->widget('english'); ?></option>
	            		<option value="vi"><?php echo $this->TRANSLATOR->widget('vietnam'); ?></option>
	            	</select>
	            	<label><?php echo $this->TRANSLATOR->widget('to'); ?></label>
	            	<select name="gUtilityDictionaryTo" id="gUtilityDictionaryTo">
	            		<option value="vi"><?php echo $this->TRANSLATOR->widget('vietnam'); ?></option>
	            		<option value="en"><?php echo $this->TRANSLATOR->widget('english'); ?></option>
	            	</select>
	            	<div class="clear pt5">
	            		<input type="button" class="button gUtilityDictionaryTranslate" value="<?php echo $this->TRANSLATOR->widget('translate'); ?>" />
	            	</div>
	            	<div class="clear content"></div>
	            	<div class="clear"></div>
	            </div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
'Gio.Utility.Widget.Dictionary'.namespace();
Gio.Utility.Widget.Dictionary.load = function(params, container) {
	Gio.Core.Widget.Loader.baseUrl = '<?php echo $this->url('core_widget_ajax'); ?>';
	Gio.Core.Widget.Loader.cacheEnable = '<?php if ($this->cacheEnable) : ?>true<?php else : ?>false<?php endif; ?>';
	Gio.Core.Widget.Loader.cacheTimeout = '<?php if ($this->cacheTimeout) : ?><?php echo $this->cacheTimeout; ?><?php else : ?>false<?php endif; ?>';
	Gio.Core.Widget.Loader.queueAction('<?php echo $this->module; ?>', '<?php echo $this->widget; ?>', 'translate', params, container, '');
	$(container).fadeIn('slow');
};

$(document).ready(function() {
	$('#<?php echo $this->unid; ?>').find('.gUtilityDictionaryTranslate').bind('click', function() {
		var text = $('#gUtilityDictionaryText').val();
		var from = $('#gUtilityDictionaryFrom').val();
		var to   = $('#gUtilityDictionaryTo').val();
		var params = 'text=' + text + '|from=' + from + '|to=' + to;
		Gio.Utility.Widget.Dictionary.load(params, $('#<?php echo $this->unid; ?>').find('.content:first'));
	});
});
</script>